# ----------------------------------------------------------------------------------------------
# load clusterindices and cluster algorithm
# - algorithm: p=dbscan(data=datapoints vector, eps=parameter Eps, 
#                       MinPts= paramter MinPoints with default 5)
#   the resulting clustering is in p$cluster 
# - idxs=cluster.stats(d=distance matrix of dataset, 
#                      clustering = partition for the evaluation through the internal indices, 
#                      alt.clustering = reference partition of 'd')
#   the index results are (doubles) 
#   - idxs$"avg.silwidth"  : silhouette coefficent
#   - idxs$"hubertgamma"   : Hubert Gamma index 
#   - idxs$"dunn"          : Dunn index
#   - idxs$"wb.ratio"      : intra-inter-mean
#   - idxs$"g2"            : Goodman/Kruskal gamma index
#   - idxs$"g3"            : G3, Gordon index 
#   - idxs$"corrected.rand": corrected rand index
#   - idxs$"cluster.number : Cluster count
require(fpc)

indices<-list( SC    			= list( name = "avg.silwidth"    , transf = function(x) (x+1)/2 )
		  	  , Gamma 			= list( name = "hubertgamma"     , transf = function(x) (x+1)/2)
	       	  , dunn  			= list( name = "dunn"            , transf = function(x) (1.25*x))
	          , iim   			= list( name = "wb.ratio"        , transf = function(x) (1-(x*0.704)))
	          , gamma 			= list( name = "g2"              , transf = function(x) (x+1)/2)
	          , G3    			= list( name = "g3"              , transf = function(x) (1-x))
	          , rand  			= list( name = "corrected.rand"  , transf = function(x) (x))
	          , ClusterCount  	= list( name = "cluster.number"  , transf = function(x) (x))
	);
	
get.notNormaliziedIndices <- function(indices) {
	notNormaliziedIndices <- indices
	for( indexName in names(indices)) {
		notNormaliziedIndices[[indexName]]$transf = function(x) (x)
	}
	notNormaliziedIndices
}
